<?php

class Application_Form_OrganizzaSerata extends Zend_Form
{

    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
        $this->setName("Organizza la tua serata");

        // Set the method for the display form to POST
        $this->setMethod('post');

        // Add an email element
        $this->addElement('text', 'email', array(
            'label'      => 'Il tuo indirizzo e-mail:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'EmailAddress',
            )
        ));

        // Add an name element
        $this->addElement('text', 'name', array(
            'label'      => 'Il tuo nome:',
            'required'   => true,
            'filters'    => array('StringTrim')
        ));

        // Add the phone element
        $this->addElement('text', 'phone', array(
            'label'      => 'il tuo numero di telefono:',
            'required'   => false,
            'validators' => array(
                array('validator' => 'digits'
                    )
                )
        ));

        $festa = $this->createElement('select','festa');
        $festa ->setLabel('Cosa vuoi organizzare:')
                ->addMultiOptions(array(
                    'comple' => 'festa di compleanno',
                    'fdl' => 'festa di laurea',
                    'anc'=>'addio al nubilato',
                    'ea'=>'evento aziendale',
                    'festa'=>'non festeggio niente (ma voglio far festa!)'
         ));
        $this->addElement($festa);

        $this->addElement('text', 'data_richiesta', array(
            'label'      => 'Quando:',
            'required'   => true,
/*
            'validators' => array(
                array('validator' => 'StringLength', 'options' => array(0, 100))
                )
*/
            )
        );
        $dateelement = $this->getElement('data_richiesta');
        $dateelement->setAttrib('id', 'datep');
        $dateelement->setAttrib('name', 'data_richiesta');

        // Add the comment element
        $this->addElement('textarea', 'note', array(
            'label'      => 'Note:',
            'required'   => false,
            'attribs'=> array(
                'COLS'=>'40',
                'ROWS'=> '10'
                ),            
            'validators' => array(
                array('validator' => 'StringLength', 'options' => array(0, 300))
                )
        ));

/*
        // Add a captcha
        $this->addElement('captcha', 'captcha', array(
            'label'      => 'Inserisci le 5 lettere qui sotto:',
            'required'   => true,
            'captcha'    => array(
                'captcha' => 'Figlet',
                'wordLen' => 5,
                'timeout' => 300
            )
        ));
*/

        // Add the submit button
        $this->addElement('submit', 'submit', array(
            'ignore'   => true,
            'label'    => 'Invia',
        ));

        // And finally add some CSRF protection
        $this->addElement('hash', 'csrf', array(
            'ignore' => true,
        ));

    }


}

